package com.toobigtofail.entities
{
	import Box2D.Dynamics.b2Fixture;
	
	import com.toobigtofail.shapes.IShape;
	
	import fabulaexmachina.box2fp.Box2DEntity;
	import fabulaexmachina.box2fp.Box2DShapeBuilder;
	
	public class Target extends Box2DEntity
	{
		public static const TYPE:String = "target";
		private var _shape:IShape;
		
		public function Target(shape:IShape)
		{
			_shape = shape;
			super(shape.X, shape.Y, shape.Width, shape.Height,shape.b2Type);
			type = Target.TYPE;
		}
		
		override public function buildShapes(friction:Number, 
											 density:Number, restitution:Number,
											 group:int, category:int, collmask:int):void { 
			_shape.buildShape(body);
		}
		
		public function serialize():XML {
			var t:XML = <target/>;
			t.appendChild(_shape.serialize());
			
			return t;
		}
	}
}